package myapps.ttclient.protocol.message.drawingscreen;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import myapps.ttclient.GlobalVariables;
import myapps.ttclient.Helper;
import myapps.ttclient.baseclass_and_interface.TTClientMessage;


public class DSOpenFileRequestMessage extends TTClientMessage
{
	public String temporaryKey = "";

	public int type;
	public String text;

	public DSOpenFileRequestMessage(String temporaryKey, int type, String text)
	{
		this.temporaryKey = temporaryKey;
		this.type = type;
		this.text = text;
	}

	public static TTClientMessage parse(DataInputStream dis) throws IOException
	{
		throw new IOException("NotImplementedException");
	}

	@Override
	public void toDataOutputStream(DataOutputStream dos) throws IOException
	{
		dos.writeByte(DS_OPEN_FILE_REQUEST);
		dos.writeInt(GlobalVariables.NO_LENGTH_CODE);
		
		Helper.WriteStringToDataOutputStream(dos, temporaryKey);
		
		dos.writeByte(this.type);
		
		Helper.WriteStringToDataOutputStream(dos, this.text);
		
	}
}
